package cn.itsource.basic.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MyWebConfigurer implements WebMvcConfigurer {
    @Autowired
    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //向mvc中添加自定义拦截器
        registry.addInterceptor(myInterceptor)
                .addPathPatterns("/**")//拦截所有内容
                .excludePathPatterns("/shop/settlement")//放行店铺商家入驻
                .excludePathPatterns("/login/**")//放行登录
                .excludePathPatterns("/user/register/phone")//放行用户手机号注册
                .excludePathPatterns("/user/register/email")//放行用户邮箱号注册
                .excludePathPatterns("/verifyCode/**")//放行验证码下面所有
                .excludePathPatterns("/fastdfs/**");//放行文件上传
    }
}
